# -*- coding: utf-8 -*-
import os
import sys
import py_global

# pip install 'pydantic[dotenv]==1.9.2'
# [dotenv]支持读取环境变量和指定的.env文件
# pydantic V2
# pip install pydantic-settings
from pydantic_settings import BaseSettings

import logging

logger = logging.getLogger(__name__)


class EnvSettings(BaseSettings):
    version: str = 'v1.0'

    class Config:
        BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
        sys.path.append(BASE_DIR)
        env_file = os.path.join(BASE_DIR, '.env')
        env_file_encoding = 'utf-8'

    pass


env = EnvSettings()

if __name__ == '__main__':
    logger.info(env.version)

    pass
